#include <stdio.h>
#include <stdlib.h>
#include <curses.h>
#include <unistd.h>

/*
   int main()
   {
   initscr();

   box(stdscr, ACS_VLINE, ACS_HLINE); //draw a box
   move(LINES/2, COLS/2); // move the cursor to the center
   waddstr(stdscr, "Hello, world!");
   refresh();
   getch();

   endwin();
   return 0;
   }
 */

int main()
{
	initscr(); /*初始化屏幕*/
	if( start_color() == OK ) { /*开启颜色*/
		init_pair( 1, COLOR_RED, COLOR_GREEN ); /*建立一个颜色对*/
		attron( COLOR_PAIR( 1 )); /*开启字符输出颜色*/
		move( LINES / 2, COLS / 2 );
		waddstr( stdscr, "Yet another Hello, world!" );
		attroff( COLOR_PAIR( 1 )); /*关闭颜色显示*/
		refresh();
	}
	else {
		waddstr( stdscr, "Can not init color" );
		refresh();
	}

	getch();

	endwin(); /*关闭curses状态*/
	return 0;
}
